package com.javabasestage2.Object.ObjectMiddle.Poly;

public class PolyExercise01 {
    public static void main(String[] args) {
        double d = 13.4;//ok
        long i = (long)d;//ok
        System.out.println(i);  //13
        int in = 5; //ok
        //boolean b = (boolean) in;  //错了，int 不能转成 boolean
        Object obj = "hello";//ok 向上转型
        String objstr = (String) obj; // ok ， 向下转型
        System.out.println(objstr); //hello

        Object objpri = new Integer(5);//ok，向上转型
       // String str = (String) objpri;//错， 指向Integer的父类引用，转成String
        Integer str1 = (Integer) objpri; // ok 向下转型
    }
}
